package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetOrderCountOfNeedUploadIdCardBean;
import com.ymatou.query.trading.api.service.GetOrderCountOfNeedUploadIdCardCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.constant.ECode;

/**
 * 获取用户名下需要上传身份证的订单个数 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetOrderCountOfNeedUploadIdCard {
	private static GetOrderCountOfNeedUploadIdCardBean goconuicbean;
	private static GetOrderCountOfNeedUploadIdCardCall goconuiccall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取用户名下需要上传身份证的订单个数");
	}

	@Before
	public void caseUp() {
		goconuicbean = new GetOrderCountOfNeedUploadIdCardBean();
		goconuiccall = new GetOrderCountOfNeedUploadIdCardCall();

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(goconuiccall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderCountOfNeedUploadIdCard_001() {
		Logger.start(true,"获取用户名下需要上传身份证的订单个数成功");
		try {
			// TODO 做个数据，需要上传身份证
			int BuyerId = 4085;
			Logger.comment("买家Id:" + BuyerId);
			goconuicbean.setBuyerId(BuyerId);
			// 发送请求
			goconuiccall.setData(goconuicbean);
			goconuiccall.callService();
			Logger.comment("goconuiccall send:" + goconuiccall.getEntityString());
			Logger.comment("goconuiccall response:" + goconuiccall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, goconuiccall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG2, goconuiccall.getMsg(),
			// "验证Msg");
			Logger.verifyEquals(true, goconuiccall.getOrderCount() >= 0, "验证记录条数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderCountOfNeedUploadIdCard_002() {
		Logger.start(true,"用户id为空");
		try {
			// TODO 做个数据，需要上传身份证
			int BuyerId = 4085;
			Logger.comment("买家Id:" + BuyerId);
			// goconuicbean.setBuyerId(BuyerId);
			// 发送请求
			goconuiccall.setData(goconuicbean);
			goconuiccall.callService();
			Logger.comment("goconuiccall send:" + goconuiccall.getEntityString());
			Logger.comment("goconuiccall response:" + goconuiccall.getReturnData());
			Logger.verifyEquals(ECode.ERROR400, goconuiccall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG2, goconuiccall.getMsg(),
			// "验证Msg");
			// Logger.verifyEquals(true, goconuiccall.getOrderCount()>=0,
			// "验证记录条数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderCountOfNeedUploadIdCard_003() {
		Logger.start(true,"用户id不存在");
		try {
			// TODO 做个数据，需要上传身份证
			int BuyerId = 1;
			Logger.comment("买家Id:" + BuyerId);
			goconuicbean.setBuyerId(BuyerId);
			// 发送请求
			goconuiccall.setData(goconuicbean);
			goconuiccall.callService();
			Logger.comment("goconuiccall send:" + goconuiccall.getEntityString());
			Logger.comment("goconuiccall response:" + goconuiccall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, goconuiccall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG2, goconuiccall.getMsg(),
			// "验证Msg");
			Logger.verifyEquals(0, goconuiccall.getOrderCount(), "验证记录条数");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}